package com.llh.demo4tree.model

import org.ktorm.entity.Entity
import org.ktorm.schema.*
import java.time.LocalDateTime


/**
 *
 * Created At 2021/8/2 16:43
 * @author llh
 */
interface TreeNode : Entity<TreeNode> {
    companion object : Entity.Factory<TreeNode>()

    val id: Int

    var name: String

    var nodePath: String?

    var pId: Int?

    var orderNum: Int
//    var rootFlag: Boolean

    var createTime: LocalDateTime

}

object TreeNodes : Table<TreeNode>("tree_node") {

    val id = int("id").primaryKey().bindTo { it.id }
    val name = varchar("name").bindTo { it.name }
    val pId = int("p_id").bindTo { it.pId }
    val nodePath = varchar("node_path").bindTo { it.nodePath }
    val orderNum = int("order_num").bindTo { it.orderNum }
    val createTime = datetime("create_time").bindTo { it.createTime }
//    val rootFlag = boolean("root_flag").bindTo { it.rootFlag }
}

